<template>
  <div
    style="
      height: calc(100% - 70px);
      width: 100%;
      display: flex;
      align-items: center;
      justify-content: center;
    "
  >
    <el-card style="width: 50%">
      <h3 style="text-align: left">修改密码</h3>
      <hr />
      <div style="text-align: left; margin-left: 20px; font-size: 12px">
        <el-form
          ref="form"
          :model="form"
          label-width="100px"
          style="padding: 60px"
        >
          <el-row>
            <el-col :span="12">
              <el-form-item label="密码">
                <el-input v-model="form.password1"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="确认密码">
                <el-input v-model="form.password2"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <div style="display: flex; justify-content: flex-end">
            <el-button @click="onSubmit()" type="primary">提交</el-button>
            <el-button @click="cancel()">取消</el-button>
          </div>
        </el-form>
      </div>
    </el-card>
  </div>
</template>

<script>
export default {
  data() {
    return {
      form: {
        password1: '',
        password2: ''
      }
    }
  },
  methods: {
    onSubmit() {
      this.$confirm('确定修改此密码?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).catch((err) => {
        this.$message({
          type: 'error',
          message: err
        })
      })
    },

    cancel() {
      ;(this.form.password1 = null), (this.form.password2 = null)
    }
  }
}
</script>

